//
//  VPaiDevice.swift
//  VPai
//
//  Created by devel on 16/9/19.
//  Copyright © 2016年 viatech. All rights reserved.
//

import Foundation

class VPaiDevice : NSObject{

    var token = ""
    var deviceid = ""
    var version = ""
    var name = ""
    var ipAddr = ""
    var type = ""
    var mediaport = 8720
    var ctrlport = 8721
    var lastActiveTime : Double = 0
    //var remoteMediaSource = RemoteMediaSource()
    var vpaiDeviceInfo = VPaiDeviceInfo()
    var ctrlUrl : String{
        get{
            return "ws://\(ipAddr):\(ctrlport)/req"
        }
    }
    var mediaUrl : String{
        get{
            return "ws://\(ipAddr):\(mediaport)/Vpaimedia"
        }
    }
    
    func startPrev(cb: ((args: CallbackArgs) -> ())?){
        VPaiMediaWebSocket.shareInstance.startPrev(){args in
            cb?(args: args)
        }
    }
    
    func stopPrev(cb: ((ret: Int) -> ())?){
        VPaiMediaWebSocket.shareInstance.stopPrev(){args in
            cb?(ret: args.ret)
        }
    }
    
    func toString() -> String{
        return "(token=\(token), deviceid=\(deviceid), version=\(version), name=\(name), ipAddr=\(ipAddr), mediaport=\(mediaport), ctrlport=\(ctrlport), lastActiveTime=\(lastActiveTime))"
    }
}